package com.hsh.erp.controller;

import com.hsh.erp.domain.common.Result;
import com.hsh.erp.domain.dto.ShopProductDTO;
import com.hsh.erp.domain.vo.ShopProductVO;
import com.hsh.erp.service.ShopProductService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author USER
 * @description 针对表【shop_product】的数据库操作Service实现
 * @createDate 2024-05-30 16:21:43
 */
@RestController
@RequestMapping("/shopProduct")
@Tag(name = "店铺商品", description = "店铺商品")
public class ShopProductController {

    @Resource
    private ShopProductService shopProductService;

    /**
     * 列表查询
     *
     * @param shopProductVO
     * @return
     */
    @GetMapping("/list")
    @Operation(summary = "列表查询")
    public Result<List<ShopProductDTO>> getList(ShopProductVO shopProductVO) {
        return shopProductService.getList(shopProductVO);
    }

    /**
     * 修改一条记录
     *
     * @param shopProductVO
     * @return
     */
    @PostMapping("/updateOne")
    @Operation(summary = "修改一条记录")
    public Result updateOne(@RequestBody ShopProductVO shopProductVO) {
        return shopProductService.updateOne(shopProductVO);
    }

    /**
     * 删除一条记录
     *
     * @param shopProductVO
     * @return
     */
    @PostMapping("/deleteOne")
    @Operation(summary = "删除一条记录")
    public Result deleteOne(@RequestBody ShopProductVO shopProductVO) {
        return shopProductService.deleteOne(shopProductVO);
    }

    /**
     * 新增一条记录
     *
     * @param shopProductVO
     * @return
     */
    @PostMapping("/addOne")
    @Operation(summary = "新增一条记录")
    public Result addOne(@RequestBody ShopProductVO shopProductVO) {
        return shopProductService.addOne(shopProductVO);
    }

}




